package com.gem.growingtree.utils;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * 从输入流中获取数据
 * 
 * @param inStream
 * @return
 * @throws Exception
 */
public class StreamTool {
	public static byte[] readInputStream(InputStream inStream) throws Exception {
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
		byte[] buffer = new byte[1024];
		int len = 0;
		while ((len = inStream.read(buffer)) != -1) {
			outputStream.write(buffer, 0, len);
		}
		inStream.close();
		return outputStream.toByteArray();

	}
}
